package hu.myai.test.util;

import hu.myai.api.triggers.AbstractTriggerConsumer;
import hu.myai.model.TriggerVO;

import java.util.ArrayList;
import java.util.List;

public class DataProviderTriggerConsumer extends AbstractTriggerConsumer {

	private class NameValue {
		protected String name;

		protected TriggerVO value;

		public NameValue(String name, TriggerVO value) {
			this.name = name;
			this.value = value;
		}
	}

	List<NameValue> nameValueList = new ArrayList<NameValue>();

	public DataProviderTriggerConsumer(String name) {
		super(name);
	}

	@Override
	protected void startCalculation(String name, TriggerVO value) {
		nameValueList.add(new NameValue(name, value));

	}

	public String getTriggerName(int index) {
		return nameValueList.get(index).name;
	}

	public TriggerVO getTriggerValue(int index) {
		return nameValueList.get(index).value;
	}

	public int getTriggerListSize() {
		return nameValueList.size();
	}

	public void reset() {
		nameValueList.clear();
	}
}
